﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Mobile.FirstWebApplication.Business;

namespace Mobile.FirstWebApplication
{
    public partial class AddUserResult : System.Web.UI.Page
    {
        protected string Result;
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((HttpContext.Current.Request.QueryString["name"] != null) && (!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["name"])) && (HttpContext.Current.Request.QueryString["age"] != null) && (HttpContext.Current.Request.QueryString["country"] != null) && (HttpContext.Current.Request.QueryString["isactive"] != null))
            {
                string name = HttpContext.Current.Request.QueryString["name"];
                string age = HttpContext.Current.Request.QueryString["age"];
                string country = HttpContext.Current.Request.QueryString["country"];
                string isactive = HttpContext.Current.Request.QueryString["isactive"];
                UserManager.AddUser(name, Boolean.Parse(isactive), country, Int32.Parse(age));
                Result = "User added";
            }
            else
            {
                Result = "Error: You have to fill all fields";
            }
        }
    }
}